from fastapi import HTTPException

class BaseExceptionWithMessage(HTTPException):
    def __init__(self, status_code: int, message: str):
        super().__init__(status_code=status_code, detail=message)

class NotFoundException(BaseExceptionWithMessage):
    def __init__(self, message: str = "资源未找到"):
        super().__init__(status_code=404, message=message)

class BadRequestException(BaseExceptionWithMessage):
    def __init__(self, message: str = "请求参数错误"):
        super().__init__(status_code=400, message=message)

class InternalServerException(BaseExceptionWithMessage):
    def __init__(self, message: str = "服务器内部错误"):
        super().__init__(status_code=500, message=message)


class SummaryServiceError(Exception):
    """Base exception for summary service errors"""
    pass

class InvalidCategoryError(SummaryServiceError):
    """Raised when an invalid category is provided"""
    pass
